<?php
class ZendX_Resource_Manager {
	static protected $_instance = NULL;
    /**
     * @static
     * @return ZendX_Resource_Manager
     */
	static public function getInstance() {
		if(self::$_instance === NULL) {
			self::$_instance = new self();
		}
		return self::$_instance;
	}
	private function __clone() {}
	protected $_container = array();
	
	protected function __construct() {
		$config = ZendX_Config_Manager::getInstance()->getConfig('manager')->toArray();
		$resourceLoader = new ZendX_Resource_Loader(array(
			'namespace' => $config['namespace'],
			'basePath' => $config['basePath']
		));
	}

    /**
     * @param $name string name of resource
     * @return Object
     */
	public function getResource($name) {
		if(!isset($this->_container[$name])) {
			$className = 'Resource_' . ucfirst(strtolower($name));
			$this->_container[$name] = new $className();
		}
		return $this->_container[$name];
	}
}